from django import forms
from django.contrib.auth.models import User, Group

class CacheAnalysisUserForm(forms.Form):
    def __init__(self, *args, **kwargs):
        forms.Form.__init__(self, *args, **kwargs)
        users = User.objects.all().order_by('username')
        self.fields['users'] = forms.ModelMultipleChoiceField(queryset=users)
    
class CacheAnalysisGroupForm(forms.Form):
    def __init__(self, *args, **kwargs):
        forms.Form.__init__(self, *args, **kwargs)
        groups = Group.objects.all().order_by('name')
        self.fields['groups'] = forms.ModelMultipleChoiceField(queryset=groups)
    